Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix foreign assets migration #3190

Merged
merged 6 commits into from
Feb 17, 2025
Merged

Fix foreign assets migration #3190

merged 6 commits into from
Feb 17, 2025

Conversation

RomarQ
Copy link
Contributor

@RomarQ RomarQ commented Feb 14, 2025

What does it do?

Fixes the foreign assets migration.

The fix has been dry-run on the following networks:

  • Moonbase Alpha
  • Moonriver
  • Moonbeam

What is being fixed?

  • When migrating approvals, some calls require calling the contract with the approval owner (a smart-contract in this case) origin, which is not allowed, only EOA can perform external calls. In the case of this migration this must be allowed.

  • The mint fails because in some situations, the target address is the burn address (0x0000...). In this scenarios, the migration should skip the minting.

  • The gas limit provided when creating the erc-20 was not big enough.

@RomarQ RomarQ self-assigned this Feb 14, 2025
@RomarQ RomarQ added B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes D3-trivial PR contains trivial changes in a runtime directory that do not require an audit not-breaking Does not need to be mentioned in breaking changes labels Feb 14, 2025
Copy link
Contributor

github-actions bot commented Feb 14, 2025

WASM runtime size check:

Compared to target branch

Moonbase runtime: 2420 KB (+4 KB) 🚨

Moonbeam runtime: 2400 KB (-8 KB) ✅

Moonriver runtime: 2400 KB (+16 KB) ⚠️

Compared to latest release (runtime-3500)

Moonbase runtime: 2420 KB (+468 KB compared to latest release) 🚨

Moonbeam runtime: 2400 KB (+464 KB compared to latest release) ⚠️

Moonriver runtime: 2400 KB (+464 KB compared to latest release) ⚠️

@RomarQ RomarQ marked this pull request as ready for review February 14, 2025 15:32
Copy link
Contributor

github-actions bot commented Feb 14, 2025

Coverage Report

@@                         Coverage Diff                         @@
##           master   rq/fix-foreign-assets-migration      +/-   ##
===================================================================
- Coverage   74.52%                            74.48%   -0.04%     
  Files         380                               380              
+ Lines       96102                             96174      +72     
===================================================================
+ Hits        71611                             71626      +15     
+ Misses      24491                             24548      +57     
Files Changed Coverage
/pallets/moonbeam-foreign-assets/src/evm.rs 63.17% (-10.85%) 🔽
/pallets/moonbeam-lazy-migrations/src/foreign_asset.rs 95.03% (-3.57%) 🔽

Coverage generated Mon Feb 17 11:21:27 UTC 2025

stiiifff
stiiifff previously approved these changes Feb 17, 2025
manuelmauro
manuelmauro previously approved these changes Feb 17, 2025
Copy link
Contributor

@ahmadkaouk ahmadkaouk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RomarQ, the changes look good. I would rerun the benchmarks to account for additional metadata read and write. For that you need to update the migrate_approval benchmark scenario and ensure metadata is added to the owner account.

@RomarQ RomarQ dismissed stale reviews from manuelmauro and stiiifff via dd81b29 February 17, 2025 10:46
@RomarQ
Copy link
Contributor Author

RomarQ commented Feb 17, 2025

@RomarQ, the changes look good. I would rerun the benchmarks to account for additional metadata read and write. For that you need to update the migrate_approval benchmark scenario and ensure metadata is added to the owner account.

The weights for this call are good enough, just tried it locally, it is fine to keep it as is. The changes do not affect PoV.

@RomarQ RomarQ merged commit 659aad4 into master Feb 17, 2025
37 checks passed
@RomarQ RomarQ deleted the rq/fix-foreign-assets-migration branch February 17, 2025 11:35
RomarQ added a commit that referenced this pull request Feb 17, 2025
* fix: foreign assets migration

* fix: warnings

* remove used method

* update hard-coded gas limits to a reasonable value

* fix test

* improve code
RomarQ added a commit that referenced this pull request Feb 17, 2025
* fix: foreign assets migration

* fix: warnings

* remove used method

* update hard-coded gas limits to a reasonable value

* fix test

* improve code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes D3-trivial PR contains trivial changes in a runtime directory that do not require an audit not-breaking Does not need to be mentioned in breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants